<template>
  <div class="bpl1-bg">
    <div class="el-flex">
      <div class="co-title-name">
        <img src="@/assets/cockpit/subdivision/securityOneMap/item1-title.png" alt="" />
      </div>
      <div class="co-title-right co-title-right-flex">
        <div class="co-title-breathe"><i></i><i></i><i></i><i></i><i></i><i></i></div>
      </div>
    </div>
    <div class="content">
      <div class="count"><span class="label">临时建筑项目数：</span><span class="number">11,233</span>处</div>
      <div class="chart1">
        <p class="title">拆除情况</p>
        <div class="bpr2-chartbox">
          <div class="bpr2-chart-bg"></div>
          <div class="box-chart" id="boxChart">
          </div>

        </div>
        <ul class="zx-list">
          <li v-for="(item, index) in listArr" :key="index">
            <div class="icon" :style="`background:${colorArr[index]}`"></div>
            <div class="label">
              {{ item.label }}

              <span>
                {{ item.value }}
              </span>
            </div>
          </li>
        </ul>
      </div>
      <div class="chart2">
        <p class="title">超期预警情况</p>
        <div class="chart-box2">
          <div class="red">
            <span>已超期</span>
            <div><span>15</span>处</div>
          </div>
          <div class="yellow">
            <span>3个月内</span>
            <div><span>15</span>处</div>
          </div>
          <div class="blue">
            <span>3-6个月内</span>
            <div><span>15</span>处</div>
          </div>
          <div class="cyan">
            <span>6个月后</span>
            <div><span>15</span>处</div>
          </div>
        </div>
      </div>
    </div>

  </div>
</template>

<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'
import Highcharts from 'highcharts/highstock'
import { CockpitApi } from '@/api/cockpit'
@Component({
  name: 'BplItem1',
  components: {}
})
export default class BplItem1 extends Vue {
  private colorArr = [
    '#49C384',
    '#2B8EF3',
    '#E42C31',
    '#F79014',
    '#DAFA94',
    '#49C384',
    '#2B8EF3',
    '#E42C31',
    '#F79014',
    '#DAFA94'
  ]
  private options: any = {
    credits: {
      enabled: false
    },
    chart: {
      type: 'pie',
      plotBackgroundColor: null,
      plotBorderWidth: null,
      plotShadow: false,
      backgroundColor: null,
      options3d: {
        enabled: true,
        alpha: 60
      }
    },
    title: {
      text: null
    },
    subtitle: {
      text: null
    },
    plotOptions: {
      pie: {
        size: 110,
        innerSize: 70,
        depth: 20,
        dataLabels: {
          //数据标签
          enabled: false //是否启用
        },
        showInLegend: false
      }
    },
    legend: {
      layout: 'vertical',
      align: 'right',
      // verticalAlign: 'middle',
      floating: true,
      symbolwidth: 6,
      symbolHeight: 6,
      itemStyle: {
        fontSize: '12px',
        color: '#fff',
        fontWeight: 'normal',
        paddingTop: '20px'
      },
      itemHoverStyle: {
        color: '#00EAFF'
      }
    },
    series: [
      {
        name: '占比（%）',
        center: ['24%', '40%'],
        colors: this.colorArr,
        data: [
          ['未拆除', 50],
          ['已拆除', 50],
          ['已延期', 50],
          ['正常使用', 50]
        ]
      }
    ]
  }

  private listArr = [
    {
      value: 10,
      label: '未拆除'
    },
    {
      value: 9,
      label: '已拆除'
    },
    {
      value: 8,
      label: '已延期'
    },
    {
      value: 7,
      label: '正常使用'
    }
  ]
  created() {}
  mounted() {
    this.init()
  }
  init() {
    // console.log(this.rankData, 'this.rankData')
    // this.options.series[0].data = this.rankData
    this.chart = new Highcharts.Chart('boxChart', this.options)
  }
}
</script>
<style lang="scss" scoped>
@import '~@/styles/cockpit.scss';
.bpl1-bg {
  width: 100%;
  height: 100%;
  padding: 16px;
  // background: url('~@/assets/cockpit/bpl1-bg.png') no-repeat right center/ 99.3% 100%;
  background: url('~@/assets/cockpit/subdivision/administration/item-bg.png') no-repeat 0/ 100% 100%;
  // background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  &::before {
    content: '';
    display: block;
    width: 20px;
    height: 103%;
    background: url('~@/assets/cockpit/bpl-bg-line.png') no-repeat 0/ 100% 100%;
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translate(0, -50%);
  }
  .co-title-right-flex {
    display: flex;
    .text {
      font-size: 12px !important;
      color: rgba(223, 254, 255, 1);
      margin-top: 8px;
      margin-right: 6px;
    }
  }
}
.content {
  margin: 17px 0;
  .count {
    display: flex;
    align-items: center;
    background: url('~@/assets/cockpit/subdivision/securityOneMap/count-bg.png') no-repeat;
    background-size: 100% 100%;
    height: 44px;
    color: #fff;
    padding-left: 17px;
    .label {
      color: rgba(0, 181, 211, 1);
      font-size: 18px !important;
    }
    .number {
      font-weight: 700;
      font-family: 'Roboto';
      margin-right: 5px;
      font-size: 26px !important;
    }
  }
  .title {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 8px;
    // line-height: 24px;
    font-size: 14px !important;
    color: #fff;
    margin-top: 18px;
    margin-bottom: 18px;
    background: linear-gradient(90deg, rgba(0, 106, 255, 1) 0%, rgba(0, 106, 255, 0) 100%);
    &::before {
      content: '';
      display: block;
      width: 2px;
      height: 8px;
      margin-right: 6px;
      background: rgba(0, 234, 255, 1);
      box-shadow: 0 0 8px 0 rgba(0, 149, 255, 1);
    }
  }
  .bpr2-chartbox {
    width: 100%;
    height: 162px;
    position: relative;
    margin-top: 14px;
    margin-left: -20px;
    .box-chart {
      width: 100%;
      height: 100%;
      margin-top: -10px;
    }
    .bpr2-chart-bg {
      width: 172px;
      height: 100px;
      background: url('~@/assets/cockpit/bpr2-chart-bg.png') no-repeat 0/ 100% 100%;
      position: absolute;
      left: 32px;
      top: 44px;
      z-index: -1;
    }
  }
  .chart1 {
    position: relative;
    .zx-list {
      position: absolute;
      right: -50px;
      top: 31px;
      color: #fff;
      font-size: 12px !important;
      display: flex;
      flex-wrap: wrap;
      width: 220px;
      margin-top: 30px;
      li {
        width: 100%;
        display: flex;
        margin-top: 8px;
        .icon {
          width: 10px;
          height: 10px;
          background: rgba(73, 195, 132, 1);
        }
        .label {
          width: calc(100% - 20px);
          margin-left: 10px;
          text-overflow: ellipsis;
          overflow: hidden;
          white-space: nowrap;
          span {
            margin-left: 4px;
          }
        }
      }
    }
  }
  .chart-box2 {
    display: flex;
    & > div {
      margin-right: 8px;
      flex-grow: 1;
      width: 100px;
      height: 57px;
      border-radius: 2px;
      background: rgba(255, 255, 255, 0.05);
      padding-top: 10px;
      padding-left: 16px;
      > span {
        font-size: 12px !important;
        display: inline-block;
        line-height: 17px;
      }
      > div {
        color: #fff;
        > span {
          font-size: 16px !important;
          line-height: 19px;
          font-weight: bold;
          font-family: 'Roboto';
          display: inline-block;
          margin-right: 4px;
        }
      }
      &.red {
        // border: 1px solid #f53951;
        & > span {
          color: #f53951;
        }
        box-shadow: inset 2px 0 8px 0 rgba(245, 57, 81, 0.65);
      }
      &.yellow {
        // border: 1px solid #f9a73d;
        & > span {
          color: #f9a73d;
        }
        box-shadow: inset 2px 0 8px 0 rgba(249, 167, 61, 0.65);
      }
      &.blue {
        // border: 1px solid #5193ff;
        & > span {
          color: #5193ff;
        }
        box-shadow: inset 2px 0 8px 0 rgba(81, 147, 255, 0.65);
      }
      &.cyan {
        & > span {
          color: #4eeca8;
        }
        // border: 1px solid #4eeca8;
        box-shadow: inset 2px 0 8px 0 rgba(78, 236, 168, 0.65);
      }
      &:last-of-type {
        margin-right: 0;
      }
    }
  }
}
</style>
